﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ext.Net;
using System.Collections.Generic;

public partial class Popup_Popup_EqpFind : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ComboBind();
        }
    }

    protected void CreateParameter(object sender, DirectEventArgs e)
    {
        string json = e.ExtraParams["Values"];

        Dictionary<string, string>[] dicValues = JSON.Deserialize<Dictionary<string, string>[]>(json);
        string strVal = string.Empty;

        foreach (Dictionary<string, string> dic in dicValues)
        {
            foreach (KeyValuePair<string, string> row in dic)
            {
                strVal += row.Value + "|";
            }
        }

        strVal = strVal.Remove(strVal.Length - 1);
        hdRowValue.Text = strVal;
    }

    private void ComboBind()
    {
        using (EmdisBest.WebService.Service oService = new EmdisBest.WebService.Service())
        {
            DataSet ds = oService.Select_DDDW_EQUIP_KIND_S();

            this.StrCbx.DataSource = ds;
            this.StrCbx.DataBind();

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                this.cbxEqp.SelectedIndex = 0;
            }
        }
    }


    protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        this.BindData();
    }

    private void BindData()
    {
        this.Store1.RemoveAll();

        using (EmdisBest.WebService.Service oService = new EmdisBest.WebService.Service())
        {
            //2012-01-14  박승한 - 매서드 없어서 주석처리 
            //DataSet ds = oService.Select_D_EQUIP_2_S(this.cbxEqp.SelectedItem.Value);
            //DataTable dtSource = ds.Tables[0];

            //this.StrCbx.DataSource = dtSource;
            //this.StrCbx.DataBind();
        }
    }

    protected void ComboChange(object sender, DirectEventArgs e)
    {
        BindData();
    }
}
